<?php
session_start();
require '../../../MApache/weblinx/weblinx.php';
require ("../Classes/Rol.php");
require ("../Classes/Setter.php");
require ("../Classes/Sentinel.php");

require ("../Forms/FrmTableRoles.php");

if(isset($_GET['EditarR'])){	
			$setter=new Setter("../Config");
			$rol=new Rol();
			$rol->setId($_GET['idRolEdit']);
			$rol->setNombre($_GET['nombreRolEdit']);
			$rol->setDescripcion($_GET['descripcionRolEdit']);

			$sectionsElegidas=array();	
			foreach ($setter->getSections() as $section){
				if($_GET[$section."Edit"]=="yes"){
					$sectionsElegidas[]=$section;			
				}
			}
			$rol->setSections($sectionsElegidas);
			$rol->actualizar();
					
			$messageBox=new MessageBox($image="../../../MApache/weblinx/Images/warning.png",$messageText="<b>Se ha actualizado el rol con éxito </b>",$okButtonName="okValidatorFrmRolEdit",$okButtonValue="ok",$okButtonEvents=array("onclick"=>"GETMethodSend('okValidatorFrmRolEdit','tableRoles','../Events/EventsFrmRolEdit.php')"),$cancelButtonName="cancelValidatorFrmRolEdit",$cancelButtonValue="cancel",$cancelButtonEvents=array("onclick"=>"GETMethodSend('cancelValidatorFrmRolEdit','tableRoles','../Events/EventsFrmRolEdit.php')"));
			$messageBox->setVisible("visible");
			$messageBox->show();
			$frmTableRoles=new FrmTableRoles();
			$frmTableRoles->show();
					
			
}
else if(isset($_GET['CancelEditarR'])){
		$frmTableRoles=new FrmTableRoles();
		$frmTableRoles->show();
}


else if(isset($_GET['okValidatorFrmRolEdit'])){
		$frmTableRoles=new FrmTableRoles();
		$frmTableRoles->show();
}
else if(isset($_GET['cancelValidatorFrmRolEdit'])){
		$frmTableRoles=new FrmTableRoles();
		$frmTableRoles->show();
}
//-------------

//---Fin Events----------------

?>